package cron.admin.service;

import cn.hutool.core.net.multipart.UploadFile;
import cn.hutool.http.ContentType;
import cn.hutool.http.server.HttpServerRequest;
import cn.hutool.http.server.HttpServerResponse;

/**
 * @author : willian fu
 * @version : 1.0
 * @date : 2021/3/10 0010 16:38
 */
public class TaskService {

    public static TaskService INSTANCE = new TaskService();

    public String getTasks(HttpServerRequest req, HttpServerResponse rsp){

        return "";
    }

    public String updateTasks(HttpServerRequest req, HttpServerResponse rsp){
        return "";
    }

    public String addTasks(HttpServerRequest req, HttpServerResponse rsp){
        final UploadFile file = req.getMultipart().getFile("file");
        // 传入目录，默认读取HTTP头中的文件名然后创建文件
        //file.write("d:/test/");
        rsp.write("OK!", ContentType.TEXT_PLAIN.toString());
        return "";
    }

    public String delTasks(HttpServerRequest req, HttpServerResponse rsp){
        return "";
    }
}
